Chris Pollett > Old Classes > CS174
( Print View )

Student Corner:
  [Submit Sec2]
  [Grades Sec2]

  [Submit Sec3]
  [Grades Sec3]

  [
Lecture Notes]
  [Discussion Board]

Course Info:
  [Texts & Links]
  [Description]
  [Course Outcomes]
  [Outcomes Matrix]
  [Course Schedule]
  [Grading]
  [Requirements/HW/Quizzes]
  [Class Protocols]
  [Exam Info]
  [Regrades]
  [University Policies]
  [Announcements]

HW Assignments:
  [Hw1]  [Hw2]  [Hw3]
  [Hw4]  [Hw5]  [Quizzes]

Practice Exams:
  [Midterm]  [Final]

                           












HW#1 --- last modified February 06 2019 04:13:04..

Solution set.

Due date: Sep 14

Files to be submitted:
  Hw1.zip

Purpose: To write a short application that uses the HTTP protocol. To write a static, but relocatable, web site.

Related Course Outcomes:

The main course outcomes covered by this assignment are:

CLO1 - Write HTML documents containing standard HTML elements including forms, tables, client-side scripts, and server-side scripts.

Specification:

This assignment will consist of three parts: To demo to me that you have install Apache, PHP, and Mysql, to write a short Java application to better understand HTTP and to write a small, relocatable web site. Make sure to include in your Hw1.zip file a readme.txt file with a list of team mates for your group and their IDs.

For the first part of the assignment, I want you to install Apache, PHP, and Mysql on your laptop and configure it so I can see each of these things is running. You may choose to install MariaDB (a non-Oracle Mysql fork) instead or Mysql. If you decide (as I suggest) to install XAMPP to get stuff running, then I will test that your installation is working by going to the phpMyAdmin page. Demoing this to me either at the start of class or before I give out grades for this homework is worth 1/2 a point. Each person in a group must show me this for the group to receive this 1/2 point. In addition to installing these programs, it is useful for this class to have a simple text editor that can be configured to display whitespace characters such as spaces, tabs, end-of-lines and to indicate if the line is longer than 80 characters. The open-source editor gedit is available on Windows, Mac, and Linux and can do this. Also, for future homeworks I might get you to use git for version control, so it wouldn't hurt to try to install it early.

For this homework, your Java program should be submitted as a single file PollettWebPageClient.java within the Hw1.zip that you submit. To test your code, the grader (probably me) will unzip your Hw1.zip and cd into that directory. Your program will then be compiled from the command line via the command:

javac PollettWebPageClient.java

using a version of Java SE as old as 1.7.0_51. Once compiled your program will be run using some variant of a line like:

java PollettWebPageClient some_path

Notice I am not adding any package info to the class I am running, and I am not switching into any sub directories of Hw1, so avoid package declarations and make sure to test from the command line, not within any IDE. Your program when run should use java.net.Socket to make a connection to port 80 of www.cs.sjsu.edu. It should obtain a java.io.OutputStream from the constructed Socket and use this to make an HTTP/1.1 GET request for /faculty/pollett/some_path. It should send the Host header with value www.cs.sjsu.edu. It should the use the java.io.InputStream obtained from the Socket to get the web server's response and use System.out to print this response verbatim. Here are a couple examples of possible some_path's that might be tested:

174.23.16f/
masters/
index.php
../pollett/

You will notice in the web server's response that it sends the headers: Accept-Ranges, X-FRAME-OPTIONS, Transfer-Encoding. For each of these headers, note down the particular value given by the CS Department web server. In a file ResponseHeaders.txt that you should also include in Hw1.zip, write up a short explanation of what each of these headers is for and what each of the values given by the CS Department web server means.

For the second part of the this homework, I want you to channel your inner crackpot and make a small web site about your favorite conspiracy theory. This site should consist of at least three HTML 5 validating pages which you should place in a conspiracy sub-folder of the Hw1.zip file you submit. One of these pages should be a file named index.php and it is from this page the grader will explore your site. The two other pages should be linked via an a tag from this page, and you should use a relative link so that it doesn't matter which subfolder of document root I test your code in. Each of your pages must also have an unordered list on it, a span tag, an img tag, and a table tag. The link for the image should be relative and the image file should be a png. Use the span tag to give a tooltip suggestion over some bold-faced text to reveal some extra-spooky, additional conspiracy information. Use tables with two columns: one for the "truth" and one for what "they" would have you believe. You should use a link tag to specify a favicon. Other than these requirements, be creative, and have fun making this site. Also, keep the conspiracies light-hearted.

Point Breakdown

Demo of Apache, PHP, Mysql running on your laptop 0.5 pt
PollettWebPageClient.java compiles and runs from the command line as described without errors or exceptions. 0.5 pt
Code well-documented and uses Javadocs that provide useful and meaningful descriptions of methods (0.5pts). Code syntax is consistently formatted, meaningful names are given to variables, methods, etc (0.5pts). 1 pt
PollettWebPageClient uses Socket class as described to make a connection to port 80 of www.cs.sjsu.edu. 0.5 pts
PollettWebPageClient uses OutputStream obtained from Socket to make GET request as described above. 1 pt
PollettWebPageClient uses InputStream obtained from Socket to retrieve the web server's response and output it as described above. 1 pt
ResponseHeaders.txt contains write-up of HTTP response headers as described above. 0.5 pt
All pages of conspiracy validate as HTML 5. 0.5 pt
Free 1/2pt to make 10 0.5 pt
Each page in conspiracy web-site uses img, span, a, and table tags as described (1pt each, graded on a scale 0 - unsatisfactory, 0.5 - partial, 1 - is completely as described) 4 pts
Total10pts